package org.openurp.edu.student.info.web.helper

import java.io.FileInputStream
import net.sf.jxls.transformer.XLSTransformer
import java.io.OutputStream
import java.io.InputStream

/**
 * @author King Sun
 */
object ExportExcelUtils {
  def excprtStudentExcel(beans: java.util.Map[String,Any], is: InputStream, os: OutputStream) {
    val transformer = new XLSTransformer();
    try {
      //将beans通过模板输入流写到workbook中
      val workbook = transformer.transformXLS(is, beans);
      //将workbook中的内容用输出流写出去
      workbook.write(os);
    } finally {
      if (os != null) {
        os.close();
      }
    }
  }
}